------- =_aaaaaaaaaa0 Content-Type: text/plain; charset="us-ascii" Paul Phillips wrote: | Here's the offending line: | | open (MAIL, "|$mailprog $FORM{'recipient'}") || die "Can't open $mailprog!\n"; ------- =_aaaaaaaaaa0 Content-Type: text/plain; charset="us-ascii" Just to be helpful, the way to do it more safely, without massive need for checking is to build a complete mail message, including header, and hand that to "sendmail -t" which then reads the recipient information out of the constructed header. [Sendmail should of course be an invocation of smail or pp, not the BSD program of that name, given the history of problems that has had] ... and since I'm sticking my neck out, here's an example script, please rip to shreds :-) ------- =_aaaaaaaaaa0 Content-Type: text/plain; charset="us-ascii" Content-Description: booking-form.cgi #!/usr/bin/perl print "Content-type: text/htm\r\n\r\n"; if ( $ENV{REQUEST_METHOD} eq "POST") { $\ = "\r\n"; # It's the POST method, so print content length and coded input from # STDIN. Then decode it and print again. $len = $ENV{CONTENT_LENGTH}; $postinput = <STDIN> ; $postinput =~ s/\+/ /g ; @QUERY_LIST = split( /&/, $postinput); foreach $item (@QUERY_LIST) { ($param, $value) = split( /=/, $item); $R{$param} = $value; } foreach $item (sort (keys %R)) { $R{$item} =~ s/%([\da-f]{1,2})/pack(C,hex($1))/eig; $R{$item} =~ s/\s+$/ /; $R{$item} =~ s/^\s+//; } } else { print <<"EOX";
This script accepts input by the POST method. Someone has invoked it with some other method. This means that either you are testing by hand, congratulations, very wise; or that someone has set up a form to call it using some other method. If it was a form, then it was:
$ENV{"HTTP_REFERER"}
EOX exit ; } foreach $musthave ( "MAILTO", "SEMINAR", "NAME", "ADDR1", "ADDR2", "TELNO"){ if ( length($R{ $musthave })Here is what was sent
$bodyEOF } else { print
Please try again later
EOF } exit ; ------- =_aaaaaaaaaa0 Content-Type: text/plain; charset="us-ascii" -- Andrew.Macpherson.1248566@bnr.co.uk - or - andrew@bnr.ca "Northern Telecom has committed to a 30% reduction in its use of paper by the year 2000." No faxes, or printouts please, just e-mail. ------- =_aaaaaaaaaa0--